import java.util.ArrayList;
import java.util.Scanner;
import java.util.Stack;

public class Solution {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println(solve(in.nextLine()));
    }
    public static int solve (String s) {
        Stack<Character> opStack = new Stack<>(); // 符号栈
        Stack<Integer> numStack = new Stack<>(); // 数据栈

        int i = 0;
        while (i < s.length()) {
            char currentChar = s.charAt(i);

            if (Character.isDigit(currentChar)) {
                // 处理多位数字
                int num = 0;
                while (i < s.length() && Character.isDigit(s.charAt(i))) {
                    num = num * 10 + (s.charAt(i) - '0');
                    i++;
                }
                numStack.push(num);
                continue; // 因为已经处理了数字，跳过i的增加
            }

            if (currentChar == '(') {
                opStack.push(currentChar);
            } else if (currentChar == ')') {
                while (opStack.peek() != '(') {
                    numStack.push(evaluate(numStack.pop(), numStack.pop(), opStack.pop()));
                }
                opStack.pop(); // 弹出 '('
            } else {
                // 当前字符是运算符
                while (!opStack.isEmpty() && precedence(opStack.peek()) >= precedence(currentChar)) {
                    numStack.push(evaluate(numStack.pop(), numStack.pop(), opStack.pop()));
                }
                opStack.push(currentChar);
            }
            i++;
        }

        // 处理剩余的运算符
        while (!opStack.isEmpty()) {
            numStack.push(evaluate(numStack.pop(), numStack.pop(), opStack.pop()));
        }

        return numStack.pop();
    }

    // 运算符优先级
    private static int precedence(char op) {
        if (op == '+' || op == '-') {
            return 1;
        }
        if (op == '*' || op == '/') {
            return 2;
        }
        return 0; // '(' 的优先级为0，永远不会出现在运算中
    }

    // 执行运算
    private static int evaluate(int b, int a, char op) {
        switch (op) {
            case '+':
                return a + b;
            case '-':
                return a - b;
            case '*':
                return a * b;
            case '/':
                return a / b; // 假设不处理除法
        }
        return 0;
    }
}